	function editGameRecord(i_RowNum, i_GameID, i_PlayerID){
		$("#row"+i_RowNum+"EditBtn").attr('hidden',true);
		$("#row"+i_RowNum+"DeleteBtn").attr('hidden',true);
		$("#row"+i_RowNum+"SaveBtn").attr('hidden',false);
		$("#row"+i_RowNum+"CancelBtn").attr('hidden',false);
		var divRebuys = $("#row"+i_RowNum+"Rebuys > div");
		var divPosition = $("#row"+i_RowNum+"Position > div");
		var divKnockouts = $("#row"+i_RowNum+"Knockouts > div");
		var divWinnings = $("#row"+i_RowNum+"Winnings > div");
		var currRebuys = divRebuys.html();
		var currPosition = divPosition.html();
		var currKnockouts = divKnockouts.html();
		var currWinnings = divWinnings.html();
		divRebuys.attr('hidden',true);
		divPosition.attr('hidden',true);
		divKnockouts.attr('hidden',true);
		divWinnings.attr('hidden',true);
		$("#row"+i_RowNum+"Rebuys").append("<input type='number' required='required' value='"+currRebuys+"'>");
		$("#row"+i_RowNum+"Position").append("<input type='number' required='required' value='"+currPosition+"'>");
		$("#row"+i_RowNum+"Knockouts").append("<input type='number' required='required' value='"+currKnockouts+"'>");
		$("#row"+i_RowNum+"Winnings").append("<input type='number' required='required' value='"+currWinnings+"'>");
	}
	
	function cancelEditGameRecord(i_RowNum, i_GameID, i_PlayerID){
		$("#row"+i_RowNum+"EditBtn").attr('hidden',false);
		$("#row"+i_RowNum+"DeleteBtn").attr('hidden',false);
		$("#row"+i_RowNum+"SaveBtn").attr('hidden',true);
		$("#row"+i_RowNum+"CancelBtn").attr('hidden',true);
		$("#row"+i_RowNum+"Rebuys > input").remove();
		$("#row"+i_RowNum+"Position > input").remove();
		$("#row"+i_RowNum+"Knockouts > input").remove();
		$("#row"+i_RowNum+"Winnings > input").remove();
		$("#row"+i_RowNum+"Rebuys > div").attr('hidden',false);
		$("#row"+i_RowNum+"Position > div").attr('hidden',false);
		$("#row"+i_RowNum+"Knockouts > div").attr('hidden',false);
		$("#row"+i_RowNum+"Winnings > div").attr('hidden',false);
	}
	
	function saveEditGameRecord(i_RowNum, i_GameID, i_PlayerID){
		var newRebuys = $("#row"+i_RowNum+"Rebuys > input").val();
		var newPosition =  $("#row"+i_RowNum+"Position > input").val();
		var newKnockouts =  $("#row"+i_RowNum+"Knockouts > input").val();
		var newWinnings =  $("#row"+i_RowNum+"Winnings > input").val();
		
		if (newRebuys && newPosition && newWinnings && newKnockouts){
			$("#row"+i_RowNum+"EditBtn").attr('hidden',false);
			$("#row"+i_RowNum+"DeleteBtn").attr('hidden',false);
			$("#row"+i_RowNum+"SaveBtn").attr('hidden',true);
			$("#row"+i_RowNum+"CancelBtn").attr('hidden',true);
		
			$.ajax({
				url : "servletGameRecord",
				type : "POST",
				data : {
					action : "update",
					gameID : i_GameID,
					playerID : i_PlayerID,
					numOfRebuys : newRebuys,
					winnings : newWinnings,
					position : newPosition,
					knockouts : newKnockouts
				},
				success : function(data, status){
					if (data.report == "success")
						{
						$("#row"+i_RowNum+"Rebuys > div").html(newRebuys);
						$("#row"+i_RowNum+"Position > div").html(newPosition);
						$("#row"+i_RowNum+"Knockouts > div").html(newKnockouts);
						$("#row"+i_RowNum+"Winnings > div").html(newWinnings);
						$("#row"+i_RowNum+"Invested").html(data.invested);
						$("#row"+i_RowNum+"Balance").html(data.balance);
						}
					else {
						alert ("Couldn't update row!");
					}
					$("#row"+i_RowNum+"Rebuys > input").remove();
					$("#row"+i_RowNum+"Position > input").remove();
					$("#row"+i_RowNum+"Knockouts > input").remove();
					$("#row"+i_RowNum+"Winnings > input").remove();
					$("#row"+i_RowNum+"Rebuys > div").attr('hidden',false);
					$("#row"+i_RowNum+"Position > div").attr('hidden',false);
					$("#row"+i_RowNum+"Knockouts > div").attr('hidden',false);
					$("#row"+i_RowNum+"Winnings > div").attr('hidden',false);
				}
			});
		}
	}
	
	function deleteGameRecord(i_RowNum,i_GameID,i_PlayerID){
		if (confirm("About to delete a row!"))
		  {
			$.ajax({
				url : "servletGameRecord",
				type : "POST",
				data : {
					action : "delete",
					gameID : i_GameID,
					playerID : i_PlayerID
				},
				success : function(data, status){
					if (data.report == "success")
					{
						$("#row"+i_RowNum).fadeOut();
					}
					else {
						alert ("Couldn't delete row!");
					}
				}
			});
		  }
	}